<script src="../../vender/angular.js"></script>

<div ng-app="app">
  <p ng-init=" person = { name: 'Bob' , freeTime: 5, moneyOnHand: 1000 } ">
    {{ person.name }} is a happy man: {{ person | happy:2:400 }}
  </p>
</div>

<script>
  angular.module('app',[])
  .filter('happy',function($http, $timeout){
    return function(input, freeTime, moneyOnHand){
      input = input || {};
      freeTime = freeTime || 0;//in hours
      moneyOnHand = moneyOnHand || 0;
      return (input.freeTime && input.freeTime > freeTime) &&
        (input.moneyOnHand && input.moneyOnHand > moneyOnHand);
    };
  });
</script>
